#!/bin/bash

# Script to compile patwarp

# Check to make sure WARP_HOME is set
#
[ -z "$WARP3D_HOME" ] && echo "Need to set WARP3D_HOME before proceeding." && exit 1

cd $WARP3D_HOME/patwarp

# Compiler must be installed

hash ifort 2>&- || { echo >&2 "The Intel fortran compiler is required (ifort).  Aborting."; exit 1;}

# Now proceed.

echo "Compiling patwarp on OS X..."
ifort -O2 -static-intel -w -traceback -fixed -fpe0 patwarp_module.f patwarp_windows_mac.f \
      -o $WARP3D_HOME/run_mac_os_x/patwarp.go

echo "Executable is in run_mac_os_x..."
/bin/rm patwarp_data.mod
